from selenium.webdriver.common.by import By

from common.base import Base


class LoginPage(Base):
    login_url = "http://139.129.26.163/user.php"

    # 输入用户名
    def input_username(self, username):
        self.send_keys(("name", "username"), username)

    # 输入密码
    def input_password(self, password):
        self.send_keys(("name", "password"), password)

    # 登录
    def login(self):
        self.click((By.NAME, "submit"))


if __name__ == '__main__':
    login = LoginPage("chrome")
    login.get("http://139.129.26.163/user.php")
    login.input_username("wanglin")
    login.input_password("123456")
    login.login()
    login.quit()
